package org.fly.api.demo.controller;

import lombok.RequiredArgsConstructor;
import org.fly.api.common.redis.utils.RedisUtil;
import org.fly.api.common.redis.utils.RedissonUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: TestRedisController
 * @Description: 测试 redis
 * @Date: 2023/12/11 14:40
 * @author: Blue
 */
@RestController
@RequestMapping("/api/redis")
@RequiredArgsConstructor
public class TestRedisController {

    private final RedisUtil redisUtil;

    @GetMapping("/save")
    public String save(){
        redisUtil.set("k1","123");
        return "OK";
    }

    @GetMapping("/query")
    public String query(){
        Object k1 = RedissonUtil.getCacheObject("k1");
        return k1.toString();
    }
}
